<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta name="description" content="">
		<title></title>

		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta content="telephone=no" name="format-detection">
		<link rel="stylesheet" href="../imgv2/css/calendar.css" />
		<style>
			.cui_calendar_item {
				cursor: pointer;
			}
		</style>

	</head>

	<body onselectstart="return!1">
		<div id="headerview" style="height: 44px;">
			<div class="cm-header cm-header--no-right" id="ui-view-16">
				<span class="cm-header-icon fl js_back">
          			<i class="icon-back"></i>
      			</span>
				<h1 class="cm-page-title js_title">选择日期</h1>
			</div>
		</div>
		<div id="main" class="hotel-page-height100">
			<div class="main-frame">
				<div class="main-viewport">
					<div class="view" style="" id="ui-view-14">
						<div class="cui_cldweek ">
							<ul>
								<li>日</li>
								<li>一</li>
								<li>二</li>
								<li>三</li>
								<li>四</li>
								<li>五</li>
								<li>六</li>
							</ul>
						</div>
						<section class="cui_cldunit">
							<font id="sectionContent"></font>
						</section>
					</div>
				</div>
	</body>

</html>
<script src="../jsv2/jQuery/jquery-1.11.2.min.js"></script>
<script src="../jsv2/lib/QueryStringParser.js"></script>
<script src="../jsv2/journey/operateData.js"></script>
<script>
	function fillCalendar(idx, obj) {
		var date = new Date(),
			cur_year = date.getFullYear(),
			cur_month = date.getMonth(),
			cur_date = date.getDate();
		var monthToday = date.getMonth();
		date.setMonth(monthToday + idx);
		var dateVar = date.getDate();
		var month = date.getMonth();
		var year = date.getFullYear();
		var monthDaysArray = new Array();
		monthDaysArray.push(31);
		monthDaysArray.push(28);
		monthDaysArray.push(31);
		monthDaysArray.push(30);
		monthDaysArray.push(31);
		monthDaysArray.push(30);
		monthDaysArray.push(31);
		monthDaysArray.push(31);
		monthDaysArray.push(30);
		monthDaysArray.push(31);
		monthDaysArray.push(30);
		monthDaysArray.push(31);
		var content = ['<h2 class="cui_cldmonth">' + year + '年' + (month + 1) + '月</h2><ul class="cui_cld_daybox">'];
		date.setDate(1);
		date.setMonth(month);
		date.setFullYear(year);
		var week = date.getDay();
		for (var i = 0; i < (monthDaysArray[month] + week); i++) {
			if (i < week) {
				content.push('<li class="cui_calendar_item"></li>');
			} else {
				if ((i + 1 - week) < dateVar && monthToday == month) {
					content.push('<li class="cui_calendar_item cui_cld_invalid cui_cld_daypass js_invalid">');
					content.push('  <em>' + (i + 1 - week) + '</em>');
					content.push('</li>	');
				} else {
					content.push('<li class="cui_calendar_item' + ((year == cur_year && month == cur_month && (i + 1 - week) == cur_date) ? ' current-date' : '') + '" onclick="show(\'' + year + '-' + (month + 1) + '-' + (i + 1 - week) + '\')">');
					content.push('  <em>' + (i + 1 - week) + '</em>');
					content.push('</li>	');
				}
			}
		}
		obj.innerHTML += content.join('');
	}
	for (var i = 0; i < 6; i++) {
		fillCalendar(i, document.getElementById("sectionContent"));
	}

	function show(datestr) {
		parentwin && parentwin.setIframeContentValue(queryString.getParam('type'), datestr);
	}
	var parentwin = window.parent;
</script>